<template>
  <div>
    <h2>5----选择喜欢的</h2>
    <div v-for="(item, index) in arr" :key="index" class="inline">
      <input v-model="list" :value="item" type="checkbox" />
      <span>{{ item }}</span>
    </div>
    <ul>
      <li v-for="(item, index) in list" :key="index">{{ item }}</li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [],
      arr: ["科幻", "喜剧", "动漫", "冒险", "科技", "军事", "娱乐", "奇闻"],
    };
  },
};
</script>

<style>
.inline {
  margin-left: 30px;
  display: inline-block;
}
</style>